<template>
    <div class="page">
        <div class="logo-image">
            <img :src="`${_oss_}images/logo_white.png`" />
        </div>
        <div class="login-modal">
            <div class="login-modal__title">
                账号注册
            </div>

            <div class="login-form" style="margin-top: 15px">
                <el-input type="text" size="large" v-model="phone" placeholder="请输入你的手机号">
                    <template #prepend>
                        <el-select v-model="num" size="large" style="width: 80px">
                            <el-option label="+86" :value="86" />
                        </el-select>
                    </template>
                </el-input>

                <el-input type="text" size="large" v-model="code" placeholder="请输入验证码" :style="`margin-top: 8px`">
                    <template #append>
                        <el-button @click="onSendCode">{{
                            codeText
                        }}</el-button>
                    </template>
                </el-input>

                <el-input type="password" size="large" v-model="password" placeholder="请输入密码" :style="`margin-top: 8px`">
                </el-input>

                <el-date-picker v-model="birthday" type="date" size="large" class="no-icon" :prefix-icon="false"
                    :clearable="false" placeholder="请选择出生日期" :style="`margin-top: 8px`" :disabledDate="birthdayDisabled"
                    value-format="YYYY-MM-DD"></el-date-picker>
            </div>

            <div class="login-btn" :style="{ marginTop: '10px' }" @click="onSubmit">
                注册
            </div>

            <div class="login-footer">

                <div class="login-btn-group">
                    <span @click="onLogin">密码登录</span>
                </div>
            </div>
        </div>
    </div>
</template>
<script setup>
import { useContent } from ".";
const {
    num,
    phone,
    birthday,
    password,
    codeText,
    code,
    birthdayDisabled,
    onSendCode,
    onLogin,
    onSubmit,
} = useContent();
</script>
<style lang="scss" scoped>
.page {
    position: relative;
    width: 100%;
    height: calc(100vh - 44px);
    background-image: url("https://yzpt-resources.oss-cn-hangzhou.aliyuncs.com/web/images/mobile/login/bg.jpg");
    background-size: cover;

    .logo-image {
        padding-top: 66px;
        text-align: center;

        img {
            width: 188px;
            height: 53px;
        }
    }

    .login-modal {
        width: 345px;
        height: 340px;
        margin-top: 54px;
        margin-left: 15px;
        padding: 24px;
        background: #fff;
        border-radius: 5px;
        box-sizing: border-box;

        &__title {
            text-align: center;
            font-size: 16px;
            color: #333;
            font-weight: 500;
        }

        .login-form {
            position: relative;
            margin-top: 31px;

            .form-footer {
                width: 100%;
                position: absolute;
                left: 0;
                bottom: -30px;
                display: flex;
                align-items: center;
                justify-content: space-between;

                .forgot-pwd {
                    color: #5185fb;
                    font-size: 12px;
                    cursor: pointer;
                    user-select: none;
                }
            }
        }

        .login-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 40px;
            font-size: 16px;
            color: #fff;
            background-color: #5185fb;
            border-radius: 3px;
        }

        .login-footer {
            display: flex;
            justify-content: space-between;
            margin-top: 16px;
            color: #666;
            font-size: 14px;

            .btn-group {
                display: flex;
                align-items: center;
                cursor: pointer;
                user-select: none;

                img {
                    width: 14px;
                    margin-right: 5px;
                    color: #666;

                    &.password-icon {
                        width: 8px;
                    }
                }
            }
        }
    }

    @media screen and (orientation: landscape) {
        height: 100%;
        background-repeat: repeat;
        padding-bottom: 5px;

        .logo-image {
            padding-top: 10px;
            text-align: center;

            img {
                width: 94px;
                height: 27px;
            }
        }

        .login-modal {
            width: 172px;
            height: auto;
            margin: 8px auto;
            padding: 8px;
            border-radius: 3px;

            &__title {
                text-align: center;
                font-size: 10px;
                color: #333;
                font-weight: 500;
            }

            .login-btn {
                width: 100%;
                height: 20px;
                font-size: 8px;
                border-radius: 3px;
            }

            .login-form {
                margin-top: 10px;

                .form-footer {
                    width: 100%;
                    position: absolute;
                    left: 0;
                    bottom: -55%;

                    .forgot-pwd {
                        font-size: 6px;
                    }
                }
            }

            .login-footer {
                margin-top: 8px;
                font-size: 7px;

                .btn-group {
                    img {
                        width: 7px;
                        margin-right: 5px;
                        color: #666;

                        &.password-icon {
                            width: 4px;
                        }
                    }
                }
            }
        }
    }
}

.login-btn-group {
    width: 100%;
    text-align: center;
    color: #5185fb;
}

:deep(.no-icon) {
    width: 100% !important;

    .el-input__prefix {
        display: none !important;
    }
}
</style>
